home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / rpg / crossfir.92 / crossfir / crossfire-0.92.5 / crossedit / crossedit.c < prev    next >
C/C++ Source or Header  |  1996-07-24  |  5KB  |  140 lines

  1. /*
  2.     Copyright (C) 1993 Jarkko Sonninen & Petri Heinila
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 2 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.     
  18.     The authors can be reached via e-mail to Jarkko.Sonninen@lut.fi
  19.     or Petri.Heinila@lut.fi .
  20. */
  21.  
  22. #include <Posix.h>
  23. #include "App.h"
  24. #include "X11.h"
  25. #include "debug.h"
  26.  
  27. /**********************************************************************
  28.  * application resources 
  29.  **********************************************************************/
  30.  
  31. #define Offset(field) XtOffsetOf(AppRes, field)
  32. static XtResource resources[] = {
  33.     {"mapWidth", "MapWidth", XtRDimension, sizeof (Dimension),
  34.     Offset (mapWidth), XtRDimension, NULL},
  35.     {"mapHeight", "MapHeight", XtRDimension, sizeof (Dimension),
  36.     Offset (mapHeight), XtRDimension, NULL},
  37.     {"usePixmaps", "UsePixmaps", XtRBoolean, sizeof (XtRBoolean),
  38.     Offset (usePixmaps), XtRImmediate, False},
  39.     {"useColorPixmaps", "UseColorPixmaps", XtRBoolean, sizeof (XtRBoolean),
  40.     Offset (useColorPixmaps), XtRImmediate, False},
  41.     {"cmdCrossfire", "CmdCrossfire", XtRString, sizeof (XtRString),
  42.     Offset (cmdCrossfire), XtRString, NULL},
  43.     {"cmdReset", "CmdReset", XtRString, sizeof (XtRString),
  44.     Offset (cmdReset), XtRString, NULL},
  45.     {"creator", "Creator", XtRString, sizeof (XtRString),
  46.     Offset (creator), XtRString, "No Body"},
  47.     {"email", "Email", XtRString, sizeof (XtRString),
  48.     Offset (email), XtRString, "none@foo.bar"},
  49. };
  50. #undef Offset
  51.  
  52. static XrmOptionDescRec options[] = {
  53.     {"-pix","*usePixmaps",XrmoptionNoArg,"TRUE"},
  54.     {"-xpm","*useColorPixmaps",XrmoptionNoArg,"TRUE"},
  55.  
  56. }; 
  57.  
  58. String fallback_resources[] = {
  59. #include <Crossedit.ad.h>
  60.     NULL
  61. };
  62.  
  63. void EditDirtyAc(Widget w, XEvent * event, String * argv, Cardinal * argc) {
  64.     debug0 ("EditDirtyAc\n");
  65. }
  66.  
  67. void Nop(Widget w, XEvent * event, String * argv, Cardinal * argc) {}
  68. XtActionsRec mainActions[] = {
  69.   {"Nop", Nop},
  70.   {"EditKey", EditDirtyAc},
  71. };
  72.  
  73. /**********************************************************************
  74.  * main
  75.  **********************************************************************/
  76.  
  77. void main (int argc, char **argv, char **env)
  78. {
  79.     XtAppContext app_con;
  80.  
  81.     App app;
  82.  
  83. /* Crossedit seems to have so many memory problems, this seems like
  84.  * a really good idea.
  85.  */
  86. #ifdef DEBUG_MALLOC_LEVEL
  87.   malloc_debug(DEBUG_MALLOC_LEVEL);
  88. #endif
  89.  
  90.  
  91.     /* crossfire init */
  92.     init_library ();
  93.     init_archetypes ();
  94.     editor = TRUE;
  95. #if 0
  96.     /* Enable this if you want people to be able to edit maps
  97.      * in a different directory other than the master map
  98.      * directory.  Note that the 'editor' directory of maps
  99.      * needs to be in LIBDIR/maps (LIBDIR/maps being where
  100.      * the maps will be saved.
  101.      *
  102.      * An alternative method would be to have a link to a high
  103.      * level directory from the master map source (ie, something
  104.      * like 'ln -s /users .LIBDIR.  Then users can select the users
  105.      * directory in the map editor, which will take them to the
  106.      * directory above their home directory, select their home directory,
  107.      * and then whatever directory they want to save the maps in.
  108.      */
  109.     if (getenv("LIBDIR")) LibDir = getenv("LIBDIR");
  110. #endif
  111.  
  112.     /*XtAppInitialize (&app_con, "Crossedit", NULL, 0,  &argc, argv, 
  113.              fallback_resources, NULL, 0);*/
  114.  
  115.     XtToolkitInitialize ();
  116.     app_con = XtCreateApplicationContext();    
  117. #if 1
  118.     XtAppSetFallbackResources (app_con, fallback_resources);
  119. #endif
  120.     XtAppAddActions(app_con,mainActions, XtNumber (mainActions));
  121.  
  122.     /*XtGetApplicationResources (app.shell, (XtPointer) & app->res,
  123.                    resources, XtNumber (resources), NULL, 0);*/
  124.  
  125.     app = AppCreate(app_con, "Crossedit", resources, XtNumber (resources),
  126.             options,XtNumber(options), &argc, argv);
  127.  
  128.  
  129.     /*** usage ***/
  130.     if (argc > 1) {
  131.       fprintf(stderr,"Usage: crossedit [-options]\n\t[-options]:\tXt-options\n\n");
  132.       exit(2);
  133.     }
  134.  
  135.     XtRealizeWidget (app->shell);
  136.     XtAppMainLoop (app_con);
  137. }
  138.  
  139. /*** End of crossfire.c ***/
  140.